<template>
  <div id="app">
    <button @click="exportXlsxFile">导出</button>
  </div>
</template>
<script>
import { exportXlsxFile } from "./utils/exportFile";
const ipcRenderer = window.require("electron").ipcRenderer;
export default {
  name: "App",
  data() {
    return {};
  },
  methods: {
    exportXlsxFile() {
      try {
        const data = [
          { subject: "aaaa", symptom: "xxx", seen: "xxxx", tips: "xxxx" },
        ];
        const headerMapping = {
          subject: "模板分类",
          symptom: "症状",
          seen: "超声影像所见",
          tips: "超声影像诊断提示",
        };
        const buffer = exportXlsxFile(data, headerMapping, "检测报告模板");
        console.log("exportXlsxFile buffer", buffer);
        ipcRenderer.send("export--file", buffer);
      } catch (error) {
        console.log("exportXlsxFile error", error);
      }
    },
  },
};
</script>
